package com.cmsky.open.food.model;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import com.cmsky.open.core.base.BaseEntity;
import com.cmsky.open.shop.model.ShopInfo;

/**
 * @author jandyfish email:jandyfish(a)gmail.com
 * @version 1.0
 * @since 1.0
 */


public class FoodInfo extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "FoodInfo";
	public static final String ALIAS_ID = "编号";
	public static final String ALIAS_NAME = "餐品名";
	public static final String ALIAS_TYPE = "餐品类型";
	public static final String ALIAS_STATE = "状态";
	public static final String ALIAS_SHOP_ID = "商户";
	public static final String ALIAS_PIC = "图片";
	public static final String ALIAS_LABEL_PRICE = "标签价";
	public static final String ALIAS_REAL_PRICE = "折扣价";
	public static final String ALIAS_EFFICACY = "营养价值";
	public static final String ALIAS_DESCRIPTION = "介绍";
	public static final String ALIAS_MAX_NUM = "每天供应量";
	
	//date formats
	
	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * 编号       db_column: id 
     */	
	
	private java.lang.Integer id;
    /**
     * 餐品名       db_column: name 
     */	
	@NotBlank @Length(max=20)
	private java.lang.String name;
    /**
     * 餐品类型       db_column: type 
     */	
	@NotNull 
	private java.lang.Integer type;
    /**
     * 状态       db_column: state 
     */	
	@NotNull @Max(127)
	private Integer state;
    /**
     * 商户       db_column: shop_id 
     */	
	@NotNull 
	private java.lang.Integer shopId;
    /**
     * 图片       db_column: pic 
     */	
	@Length(max=100)
	private java.lang.String pic;
    /**
     * 标签价       db_column: label_price 
     */	
	@NotNull 
	private java.lang.Float labelPrice;
    /**
     * 折扣价       db_column: real_price 
     */	
	@NotNull 
	private java.lang.Float realPrice;
    /**
     * 营养价值       db_column: efficacy 
     */	
	@Length(max=50)
	private java.lang.String efficacy;
    /**
     * 介绍       db_column: description 
     */	
	@Length(max=100)
	private java.lang.String description;
	
	private Integer maxNum;
	
	//columns END

	public FoodInfo(){
	}

	public FoodInfo(
		java.lang.Integer id
	){
		this.id = id;
	}

	public void setId(java.lang.Integer value) {
		this.id = value;
	}
	
	public java.lang.Integer getId() {
		return this.id;
	}
	public void setName(java.lang.String value) {
		this.name = value;
	}
	
	public java.lang.String getName() {
		return this.name;
	}
	public void setType(java.lang.Integer value) {
		this.type = value;
	}
	
	public java.lang.Integer getType() {
		return this.type;
	}
	public void setState(Integer value) {
		this.state = value;
	}
	
	public Integer getState() {
		return this.state;
	}
	public void setShopId(java.lang.Integer value) {
		this.shopId = value;
	}
	
	public java.lang.Integer getShopId() {
		return this.shopId;
	}
	public void setPic(java.lang.String value) {
		this.pic = value;
	}
	
	public java.lang.String getPic() {
		return this.pic;
	}
	public void setLabelPrice(java.lang.Float value) {
		this.labelPrice = value;
	}
	
	public java.lang.Float getLabelPrice() {
		return this.labelPrice;
	}
	public void setRealPrice(java.lang.Float value) {
		this.realPrice = value;
	}
	
	public java.lang.Float getRealPrice() {
		return this.realPrice;
	}
	public void setEfficacy(java.lang.String value) {
		this.efficacy = value;
	}
	
	public java.lang.String getEfficacy() {
		return this.efficacy;
	}
	public void setDescription(java.lang.String value) {
		this.description = value;
	}
	
	public java.lang.String getDescription() {
		return this.description;
	}
	
	private Set foodAreaInfos = new HashSet(0);
	private List AreaInfos;
	
	public List getAreaInfos() {
		return AreaInfos;
	}

	public void setAreaInfos(List areaInfos) {
		AreaInfos = areaInfos;
	}

	public void setFoodAreaInfos(Set<FoodAreaInfo> foodAreaInfo){
		this.foodAreaInfos = foodAreaInfo;
	}
	
	public Set<FoodAreaInfo> getFoodAreaInfos() {
		return foodAreaInfos;
	}
	
	private Set foodOrderInfos = new HashSet(0);
	public void setFoodOrderInfos(Set<FoodOrderInfo> foodOrderInfo){
		this.foodOrderInfos = foodOrderInfo;
	}
	
	public Set<FoodOrderInfo> getFoodOrderInfos() {
		return foodOrderInfos;
	}
	
	private ShopInfo shopInfo;
	
	public void setShopInfo(ShopInfo shopInfo){
		this.shopInfo = shopInfo;
	}
	
	public ShopInfo getShopInfo() {
		return shopInfo;
	}

	public Integer getMaxNum() {
		return maxNum;
	}

	public void setMaxNum(Integer maxNum) {
		this.maxNum = maxNum;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Id",getId())
			.append("Name",getName())
			.append("Type",getType())
			.append("State",getState())
			.append("ShopId",getShopId())
			.append("Pic",getPic())
			.append("LabelPrice",getLabelPrice())
			.append("RealPrice",getRealPrice())
			.append("Efficacy",getEfficacy())
			.append("Description",getDescription())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof FoodInfo == false) return false;
		if(this == obj) return true;
		FoodInfo other = (FoodInfo)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.append(getName(),other.getName())
			.append(getType(),other.getType())
			.append(getState(),other.getState())
			.append(getShopId(),other.getShopId())
			.append(getPic(),other.getPic())
			.append(getLabelPrice(),other.getLabelPrice())
			.append(getRealPrice(),other.getRealPrice())
			.append(getEfficacy(),other.getEfficacy())
			.append(getDescription(),other.getDescription())
			.isEquals();
	}
}

